<!DOCTYPE html>
<#assign secSelect = JspTaglibs["http://www.casic304.cn/secSelect"] />
<#assign fillDept=JspTaglibs["http://www.casic304.cn/fillDept"] />
<#assign dicSelect = JspTaglibs["http://www.casic304.cn/dicSelect"]/>
<html>
<head>
    <meta charset="utf-8">
    <title>质量成本基本信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
    <style>
        .qbdms-formBody{
            border: none;
        }
        .qbdms-textarea{
            margin: 8px 0;
        }
        .groupQualityCost{
            border: 1px solid #E4E7ED;
        }
        .groupQualityCostItem{
            height:64px;
            /*background-color: #F9FBFE;*/
            margin-top: 8px;
            border: 1px solid #E4E7ED;
            border-bottom: none;
        }
        .multilinebrea {
            height: 36px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            line-clamp: 2;
            -webkit-box-orient: vertical;
        }
    </style>
    <#if isClose == 'true'>
    <style>
        .listBody .qbdms-bodyDiv{padding: 0 }
        body.qbdms-particulars .qbdms-bodyDiv div.layui-table-view-body{padding: 16px}
        .layui-form-select .layui-input{padding-right: 0}
    </style>
</#if>
</head>
<body class="listBody qbdms-particulars">
<div class="qbdms-bodyDiv">
    <div class="layui-table-view-body qbdms-add-view-body">
        <#if isClose != 'true'><div class="qbdms-formTitle">质量成本信息 <i  class="qbdms-returnOn closeWindow">返回</i></div></#if>
        <form class="layui-form formPreview" requrl="${ctx}/qbdms/wQbdQualityCost/get" lay-filter="wQbdQualityCostDataForm">
            <div class="" style="width: 100%;overflow-x: auto">
                <!--<div class="dragInfo temSpace" colspan="2" rowspan="1" id="tbxx"></div>-->
                <table class="tableExcel qbdms-zeroTable" width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tbody>
                    <tr id="tbxx"></tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">单位名称</td>
                        <td name="companyName"></td>
                        <td class="qbdms-zeroTable-lable">密级<span style="color: red;">*</span></td>
                        <td ><@secSelect.sec_select data_src=1 required=true name="secret"/></td>
                        <td class="qbdms-zeroTable-lable">年度<span style="color: red;">*</span></td>
                        <td name="year"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">统计期<span style="color: red;">*</span></td>
                        <td ><@dicSelect.dic name="statisticalPeriod" nodeKey="tjq" activity=true verify="required"  reqtext="统计期是必填项"/></td>
                        <td class="qbdms-zeroTable-lable">型号代号<span style="color: red;">*</span></td>
                        <td >
                            <select name="modelCode" id="modelCode" lay-filter="modelCode" lay-verify="required" lay-reqtext="型号代号是必填项"/></select>
                        </td>
                        <td class="qbdms-zeroTable-lable">型号名称<span style="color: red;">*</span></td>
                        <td name="modelName"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">型号类别<span style="color: red;">*</span></td>
                        <td colspan="5">
                            <@dicSelect.dic name="modelType" nodeKey="xhlb" activity=true verify="required" reqtext="型号类别是必填项" />
                        </td>
                    </tr>
                    </tbody>
                </table>

                <table  class="tableExcel qbdms-zeroTable groupQualityCostItem" width="100%" border="0" cellspacing="0" cellpadding="0" >
                    <tbody>
                    <tr>
                        <td class="qbdms-zeroTable-lable">预防成本(万元)</td>
                        <td name="preventionCost" colspan="5"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">质量工作费(万元)</td>
                        <td name="qualityOperatingExpenses"></td>
                        <td class="qbdms-zeroTable-lable">质量教育培训费(万元)</td>
                        <td name="qualityEdducationTrainFee"></td>
                        <td class="qbdms-zeroTable-lable">质量评审费(万元)</td>
                        <td name="qualityReviewFee"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">质量奖励费(万元)</td>
                        <td name="qualityIncentiveFee"></td>
                        <td class="qbdms-zeroTable-lable">质量改进措施费(万元)</td>
                        <td name="qualityInprovementMeasure"></td>
                        <td class="qbdms-zeroTable-lable">质量管理人员薪酬(万元)</td>
                        <td name="qualityManagementPersonnel"></td>
                    </tr>
                    </tbody>
                </table>

                <table  class="tableExcel qbdms-zeroTable groupQualityCostItem" width="100%" border="0" cellspacing="0" cellpadding="0" >
                    <tbody>
                    <tr>
                        <td class="qbdms-zeroTable-lable">鉴定成本(万元)</td>
                        <td name="appraisalCosts" colspan="5"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">检验试验办公费(万元)</td>
                        <td name="inspectionTestOfficeExpense"></td>
                        <td class="qbdms-zeroTable-lable">检验设备折旧费(万元)</td>
                        <td name="equipmentDepreciationCost"></td>
                        <td class="qbdms-zeroTable-lable">检验试验费(万元)</td>
                        <td name="inspectionTestFee"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">鉴定人员薪酬(万元)</td>
                        <td name="salaryAppraisers"></td>
                        <td class="qbdms-zeroTable-lable">检验设备维护校对费(万元)</td>
                        <td name="equipmentMaintenance"></td>
                        <td class="qbdms-zeroTable-lable">其他(万元)</td>
                        <td name="appraisalCostOther"></td>
                    </tr>
                    </tbody>
                </table>


                <table  class="tableExcel qbdms-zeroTable groupQualityCostItem" width="100%" border="0" cellspacing="0" cellpadding="0" >
                    <tbody>
                    <tr>
                        <td class="qbdms-zeroTable-lable">内部故障成本(万元)</td>
                        <td name="internalFailureCost" colspan="5"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">报废损失费(万元)</td>
                        <td name="scrapLossExpenses"></td>
                        <td class="qbdms-zeroTable-lable">更改设计损失费(万元)</td>
                        <td name="changeDesignLossFee"></td>
                        <td class="qbdms-zeroTable-lable">备件损失(万元)</td>
                        <td name="sparePartsCost"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">事故分析损失费(万元)</td>
                        <td name="accidentAnalysisLoss"></td>
                        <td class="qbdms-zeroTable-lable">返工返修损失费(万元)</td>
                        <td name="reworkRepairLoss"></td>
                        <td class="qbdms-zeroTable-lable">产品降级损失费(万元)</td>
                        <td name="productDegradationLossFee"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">停工损失(万元)</td>
                        <td name="stopLoss"></td>
                        <td class="qbdms-zeroTable-lable">试验损失费(万元)</td>
                        <td name="testLoss"></td>
                        <td class="qbdms-zeroTable-lable">其他(万元)</td>
                        <td name="internalFailureCostOther"></td>
                    </tr>
                    </tbody>
                </table>

                <table  class="tableExcel qbdms-zeroTable groupQualityCostItem" width="100%" border="0" cellspacing="0" cellpadding="0" >
                    <tbody>
                    <tr>
                        <td class="qbdms-zeroTable-lable">外部故障成本(万元)</td>
                        <td name="externalFailureCost" colspan="5"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">索赔损失费(万元)</td>
                        <td name="claimForLoss"></td>
                        <td class="qbdms-zeroTable-lable">产品降价损失费(万元)</td>
                        <td name="productPriceReductionLoss"></td>
                        <td class="qbdms-zeroTable-lable">退货损失费(万元)</td>
                        <td name="lossOnReturns"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">诉讼费(万元)</td>
                        <td name="legalFees"></td>
                        <td class="qbdms-zeroTable-lable">保修费(万元)</td>
                        <td name="maintenanceFee"></td>
                        <td class="qbdms-zeroTable-lable">其他(万元)</td>
                        <td name="externalFailureCostOther"></td>
                    </tr>
                    </tbody>
                </table>

                <table  class="tableExcel qbdms-zeroTable groupQualityCostItem" width="100%" border="0" cellspacing="0" cellpadding="0" >
                    <tbody>
                    <tr>
                        <td class="qbdms-zeroTable-lable">外部故障成本(A)(万元)</td>
                        <td name="externalFailureCostA" colspan="5"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">索赔损失费(A)(万元)</td>
                        <td name="claimForLossA"></td>
                        <td class="qbdms-zeroTable-lable">产品降价损失费(A)(万元)</td>
                        <td name="productPriceReductionLossA"></td>
                        <td class="qbdms-zeroTable-lable">退货损失费(A)(万元)</td>
                        <td name="lossOnReturnsA"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">诉讼费(A)(万元)</td>
                        <td name="legalFeesA"></td>
                        <td class="qbdms-zeroTable-lable">保修费(A)(万元)</td>
                        <td name="maintenanceFeeA"></td>
                        <td class="qbdms-zeroTable-lable">其他(A)(万元)</td>
                        <td name="externalFailureCostOtherA"></td>
                    </tr>
                    </tbody>
                </table>

                <table  class="tableExcel qbdms-zeroTable groupQualityCostItem" width="100%" border="0" cellspacing="0" cellpadding="0" >
                    <tbody>
                    <tr>
                        <td class="qbdms-zeroTable-lable">外部故障成本(B)(万元)</td>
                        <td name="externalFailureCostB" colspan="5"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">索赔损失费(B)(万元)</td>
                        <td name="claimForLossB"></td>
                        <td class="qbdms-zeroTable-lable">产品降价损失费(B)(万元)</td>
                        <td name="productPriceReductionLossB"></td>
                        <td class="qbdms-zeroTable-lable">退货损失费(B)(万元)</td>
                        <td name="lossOnReturnsB"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">诉讼费(B)(万元)</td>
                        <td name="legalFeesB"></td>
                        <td class="qbdms-zeroTable-lable">保修费(B)(万元)</td>
                        <td name="maintenanceFeeB"></td>
                        <td class="qbdms-zeroTable-lable">其他(B)(万元)</td>
                        <td name="externalFailureCostOtherB"></td>
                    </tr>
                    </tbody>
                </table>

                <table  class="tableExcel qbdms-zeroTable groupQualityCostItem" width="100%" border="0" cellspacing="0" cellpadding="0" >
                    <tbody>
                    <tr>
                        <td class="qbdms-zeroTable-lable">外部故障成本(C)(万元)</td>
                        <td name="externalFailureCostC" colspan="5"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">索赔损失费(C)(万元)</td>
                        <td name="claimForLossC"></td>
                        <td class="qbdms-zeroTable-lable">产品降价损失费(C)(万元)</td>
                        <td name="productPriceReductionLossC"></td>
                        <td class="qbdms-zeroTable-lable">退货损失费(C)(万元)</td>
                        <td name="lossOnReturnsC"></td>
                    </tr>
                    <tr>
                        <td class="qbdms-zeroTable-lable">诉讼费(C)(万元)</td>
                        <td name="legalFeesC"></td>
                        <td class="qbdms-zeroTable-lable">保修费(C)(万元)</td>
                        <td name="maintenanceFeeC"></td>
                        <td class="qbdms-zeroTable-lable">其他(C)(万元)</td>
                        <td name="externalFailureCostOtherC"></td>
                    </tr>
                    </tbody>
                </table>


                <table  class="tableExcel qbdms-zeroTable groupQualityCostItem" width="100%" border="0" cellspacing="0" cellpadding="0" >
                    <tbody>
                    <tr>
                        <td class="qbdms-zeroTable-lable">军品营业总收入（财务快报数）(万元)</td>
                        <td name="totalMilitaryRevenue"></td>
                        <td class="qbdms-zeroTable-lable">军品营业总成本（财务快报数）(万元)</td>
                        <td name="totalMilitaryOperatingCost" colspan="3"></td>
                    </tr>

                    </tbody>
                </table>
                <input type="hidden" name="year"  placeholder="请输入"
                       autocomplete="off" id="year" class="layui-input dateTimeFiled time-init year" maxlength="50" fieldname="year"
                       lay-verify="required" lay-reqtext="年度是必填项" />
                <input type="hidden" name="id"  placeholder="请输入" fieldname="id" autocomplete="off" class="layui-input" maxlength="50">
            </div>

            <#if isClose != 'true'>
            <div class="layui-form-item btnformItem">
                <p>
                    <button type="reset" id="closeWindow"
                            class="layui-btn layui-btn-sm btn-save qbdms-oneBtnLine">返回
                    </button>
                </p>
            </div>
        </#if>
        </form>
    </div>
</div>

<script type="text/html" template>

</script>
<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>
<script>
    layui.config({
        base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'setter', 'form','layer','form', 'table', 'common', 'laydate','propsHandle', 'jquery'], function () {

        var $ = layui.jquery,
            laydate = layui.laydate,
            setter = layui.setter,  // 配置信息
            layer = layui.layer,
            form = layui.form;

        var dateTimeFiledLen = $(".dateTimeFiled");
        var common = layui.common;
        var propsHandle = layui.propsHandle;

        var  defProps = {
                //viewMould: 'form/formDef/view/formDesign/moulds/', // 组件模块 存放文件 *****
                viewMould: 'moulds/', // 组件模块 存放文件 *****
                formAreaInfo: '.formPreview',
                formAreaInfo: 'html',
                temDate: '.temDate',
                uploadFileBtn: '.uploadFileBtn',
                uploadImgBtn: '.uploadImgBtn',
                richTextArea: '.richTextArea',
                selectInput: '.selectInput',
                radioOptionCont: '.radioOptionCont',
                dataLexiTree: '.dataLexiTree',
                selectorBtn: '.selectorBtn'
            },
            temQuery = new propsHandle();  // 实例化模板功能部分

        // 初始化模板功能
        temQuery.initTem({
            selectorBtn: defProps.selectorBtn,
            selectorTemPath: setter.views + defProps.viewMould
        });
        //年选择器
        laydate.render({
            elem: '#year'
            , type: 'year'
            , trigger: 'click'
        });

        //- 添加表单验证规则 开始 ---------------------------------------------------------------------
        form.verify({
//            integer: [/^[+]{0,1}(\d+)$/,'请输入正整数'],
//            money: [/^((0{1}\.\d{1,2})|([1-9]\d*\.{1}\d{1,2})|([1-9]+\d*))$/,'请输入正整数和两位小数的数据'],
            length100: [/^.{0,100}$/, '输入字符数不能超过100'],
            length2000: [/^.{0,2000}$/, '输入字符数不能超过2000'],
            fileRequired: [/[\S]+/, "没有上传对应附件"],
            money: function (value) {
                if (value && !new RegExp(/^((0{1}\.\d{1,2})|([1-9]\d*\.{1}\d{1,2})|([1-9]+\d*))$/).test(value)) {
                    return '请输入数字且小数最多两位';
                }
            },
            integer: function (value) {
                if (value && !new RegExp(/^[+]{0,1}(\d+)$/).test(value)) {
                    return '请输入正整数';
                }
            }
        });
        //- 添加表单验证规则 结束 ---------------------------------------------------------------------

        var runId = "${runId}";
        if(runId == null || runId == ''){
            $("#hideAndShow").show();
        }

        var id = "${id}";
        // if (id == null || id === '') {
        //     $("#tbxx").html("<span class='qbdms-TBinformation'>填报信息:</span><span class='qbdms-TBinformationText'>【${filldept}   | ${fillman}  | ${filldate}】</span>");
        // }

        form.on('select(modelCode)', function (data) {
            $("input[name='modelName']").val(data.elem[data.elem.selectedIndex].getAttribute("xhmc"));
        });

        var companyName = "${companyName}";
        $("input[name='companyName']").val(companyName);

        //关闭当前页面
        $("#closeWindow,.closeWindow").click(function () {
            window.location.href = '${ctx}/qbdms/wQbdQualityCost/view/list';
        });

        //- 计算总金额 绑事件 开始 -------------------------------------------------------------
        // 预防成本
        $(document).on("blur", ".prevention", preventionMoney);
        function preventionMoney() {
            var objArr = $(".prevention");
            var sumMoney = 0;
            objArr.each(function () {
                var money = $(this).val();
                if (isNaN(money * 1)) {
                    return;
                }
                sumMoney += 1 * (money == "" ? 0 : money);
            });
            $("[name='preventionCost']").val(Math.round(sumMoney * 100) / 100);
        }

        // 鉴定成本
        $(document).on("blur", ".appraisal", appraisalMoney);
        function appraisalMoney() {
            var objArr = $(".appraisal");
            var sumMoney = 0;
            objArr.each(function () {
                var money = $(this).val();
                if (isNaN(money * 1)) {
                    return;
                }
                sumMoney += 1 * (money == "" ? 0 : money);
            });
            $("[name='appraisalCosts']").val(Math.round(sumMoney * 100) / 100);
        }

        //内部故障成本
        $(document).on("blur", ".internalFailure", internalFailureMoney);
        function internalFailureMoney() {
            var objArr = $(".internalFailure");
            var sumMoney = 0;
            objArr.each(function () {
                var money = $(this).val();
                if (isNaN(money * 1)) {
                    return;
                }
                sumMoney += 1 * (money == "" ? 0 : money);
            });
            $("[name='internalFailureCost']").val(Math.round(sumMoney * 100) / 100);
        }

        //外部故障成本
        $(document).on("blur", ".externalFailure", externalFailureMoney);
        function externalFailureMoney() {
            var objArr = $(".externalFailure");
            var sumMoney = 0;
            objArr.each(function () {
                var money = $(this).val();
                if (isNaN(money * 1)) {
                    return;
                }
                sumMoney += 1 * (money == "" ? 0 : money);
            });
            $("[name='externalFailureCost']").val(Math.round(sumMoney * 100) / 100);
        }

        //外部故障成本A
        $(document).on("blur", ".externalFailureA", externalFailureAMoney);
        function externalFailureAMoney() {
            var objArr = $(".externalFailureA");
            var sumMoney = 0;
            objArr.each(function () {
                var money = $(this).val();
                if (isNaN(money * 1)) {
                    return;
                }
                sumMoney += 1 * (money == "" ? 0 : money);
            });
            $("[name='externalFailureCostA']").val(Math.round(sumMoney * 100) / 100);
        }

        //外部故障成本B
        $(document).on("blur", ".externalFailureB", externalFailureBMoney);
        function externalFailureBMoney() {
            var objArr = $(".externalFailureB");
            var sumMoney = 0;
            objArr.each(function () {
                var money = $(this).val();
                if (isNaN(money * 1)) {
                    return;
                }
                sumMoney += 1 * (money == "" ? 0 : money);
            });
            $("[name='externalFailureCostB']").val(Math.round(sumMoney * 100) / 100);
        }

        //外部故障成本C
        $(document).on("blur", ".externalFailureC", externalFailureCMoney);
        function externalFailureCMoney() {
            var objArr = $(".externalFailureC");
            var sumMoney = 0;
            objArr.each(function () {
                var money = $(this).val();
                if (isNaN(money * 1)) {
                    return;
                }
                sumMoney += 1 * (money == "" ? 0 : money);
            });
            $("[name='externalFailureCostC']").val(Math.round(sumMoney * 100) / 100);
        }
        //- 计算总金额 绑事件 结束 -------------------------------------------------------------


        var xhdh = eval('${xhdh}'); //型号代号
        var initXHDH = function (optionObj, item) {
            optionObj.text = item.fModelcode;
            optionObj.value = item.id;
            optionObj.setAttribute("xhmc", item.fModelname);
        };
        common.initDicData("modelCode", xhdh, "", initXHDH);

        common.updateForm({
            name: 'wQbdQualityCostDataForm',
            idValue: "${id}",
            primary: "id",
            getCallback:function (data) {
                var returnData = data.data;
                $("#tbxx").html("<td class='qbdms-zeroTable-lable'>填报信息:</td><td colspan='5' class=''>【" + data.data.filldept + " | " + data.data.fillman + " | " + data.data.filldate + "】</td>");

            }
        });

        form.render();

        $("body *").not("#closeWindow").attr("disabled", "disabled");
        $(".uploadFileCont .qbdms-fileUp,.uploadFileCont i,.addFormTr1").hide();
    });
</script>
</body>
</html>